package com.bidevalution.controller.api;

import com.bidevalution.business.service.BeSectionEvalutionResultService;
import com.bidevalution.dao.entity.BeSectionEvalutionResult;
import com.bidevalution.dao.entity.BeSectionParticipant;
import com.qtp.common.core.ContextHolderUtils;
import com.qtp.core.model.Paging;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @author shenh@glodon.com
 * @date 2019-05-15 11:36
 */
@Log4j2
@RestController
@RequestMapping("/beSectionEvalutionResult")
public class BeSectionEvalutionResultController extends BaseController {
    @Autowired
    private BeSectionEvalutionResultService beSectionEvalutionResultService;
    /**
     * 获取投标单位信息列表
     * @param sectionId 标段Id
     * @return
     */
    @RequestMapping(value = "/getEvalutionResultList")
    @ResponseBody
    public void getEvalutionResultList(HttpServletResponse response, @RequestParam("sectionId")String sectionId,
                                   @RequestParam(value="participantName",required=false)String participantName,
                                   @RequestParam("page")int page, @RequestParam("rp")int rp) {
        try {
            setHttpServletResponse(response);
            Paging<List<BeSectionEvalutionResult>> btnResponse = beSectionEvalutionResultService.getEvalutionResultList(sectionId,participantName,page,rp);
            long total = btnResponse.getTotal();
            ContextHolderUtils.outGridJson(response, btnResponse.getData(), total,"yyyy-MM-dd HH:mm:ss");
        } catch (Exception e) {
            log.error(e.getMessage());
        }
    }
}
